﻿<%@ Page Title="Profile Page" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="Profile.aspx.vb" Inherits="BeachesInGreeceComplete.Profile" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            color: #9933FF;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <div class="ProfileLeftSide">
        <h2>
            <asp:Label ID="lbl_UserName" runat="server" Font-Size="X-Large"></asp:Label></h2>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
            <ItemTemplate>
                <img src='<%# Eval("Picture") %>' alt="No Picture" width="150" height="150" />
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <asp:Label ID="lbl_RoleName" runat="server" Font-Size="Large" ForeColor="#9900FF"></asp:Label>
        <br />
        <asp:Repeater ID="Repeater8" runat="server" DataSourceID="SqlDataSource5">
            <ItemTemplate>
                Total Posts : <a id="RepeaterStyle" href="BeachesTouristList.aspx?Tourist=<%# getTouristName() %>">
                    <%# getTotalPosts(Eval("TotalPosts")) %></a>
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSource2">
            <ItemTemplate>
                Total Comments : <span id="RepeaterStyle">
                    <%# Eval("TotalComments") %></span>
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <asp:Repeater ID="Repeater3" runat="server" DataSourceID="SqlDataSource1">
            <ItemTemplate>
                Joined : <span id="RepeaterStyle">
                    <%# getDateFrom(Eval("DateCreated")) %></span>
            </ItemTemplate>
        </asp:Repeater>
        <hr />
        <asp:Repeater ID="Repeater6" runat="server" DataSourceID="SqlDataSource3">
            <ItemTemplate>
                Total visits for this profile : <span id="RepeaterStyle">
                    <%# Eval("TotalViews") %></span>
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <span class="style1"><em>Most Recent Visitors</em></span>
        <br />
        <asp:Repeater ID="Repeater7" runat="server" DataSourceID="SqlDataSource4">
            <ItemTemplate>
                <a id="RepeaterStyle" href="Profile.aspx?Tourist=<%# Eval("TouristVisitor") %>">
                    <%# Eval("TouristVisitor") %></a>
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <hr />
        <asp:Button ID="btn_EditProfile" runat="server" Text="Edit Profile" CssClass="m-btn blue"
            PostBackUrl="~/EditProfile.aspx" />
    </div>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div class="ProfileCenterSide">
                <br />
                <asp:Accordion ID="AccordionProfile" CssClass="accordion" HeaderCssClass="accordionHeader"
                    HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
                    runat="server">
                    <Panes>
                        <asp:AccordionPane ID="AccordionPanePI" runat="server">
                            <Header>
                                <h3>
                                    Personal Information</h3>
                                <br />
                                <br />
                            </Header>
                            <Content>
                                <asp:Repeater ID="Repeater4" runat="server" DataSourceID="SqlDataSource1">
                                    <ItemTemplate>
                                        <b>Name : &nbsp;</b>
                                        <%# Eval("FirstName") %>
                                        <%# Eval("LastName") %>
                                        <br />
                                        <b>Email &nbsp;: &nbsp;</b>
                                        <%# Eval("TouristEmail") %>
                                        <br />
                                        <b>Age &nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;</b>
                                        <%# getAgeFrom(Eval("DateOfBirth"))%>
                                        <br />
                                        <br />
                                        <b>Date of Birth : </b>
                                        <%# getDateFrom(Eval("DateOfBirth"))%>
                                        <br />
                                        <br />
                                    </ItemTemplate>
                                </asp:Repeater>
                            </Content>
                        </asp:AccordionPane>
                        <asp:AccordionPane ID="AccordionPaneAboutMe" runat="server">
                            <Header>
                                <h3>
                                    About me</h3>
                                <br />
                                <br />
                            </Header>
                            <Content>
                                <asp:Repeater ID="Repeater5" runat="server" DataSourceID="SqlDataSource1">
                                    <ItemTemplate>
                                        <b>About me : &nbsp;</b>
                                        <%# Eval("Description") %>
                                        <br />
                                        <b>I live in : &nbsp;</b>
                                        <%# Eval("Location") %>
                                        <br />
                                    </ItemTemplate>
                                </asp:Repeater>
                                <b>I have been in...</b>
                                <asp:Label ID="lbl_Places" runat="server" Text="Not visited Greece yet" Visible="True"></asp:Label>
                                <asp:Repeater ID="Repeater10" runat="server" DataSourceID="SqlDataSource8">
                                    <ItemTemplate>
                                        <a id="RepeaterStyle" href="BeachesRegionList.aspx?Region=<%# Eval("Region") %>">
                                            <%# Eval("Region")%></a>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </Content>
                        </asp:AccordionPane>
                        <asp:AccordionPane ID="AccordionPane1" runat="server">
                            <Header>
                                <br />
                                <h3>
                                    Personal Messages</h3>
                                <br />
                                <br />
                            </Header>
                            <Content>
                                <div class="CommentsDetailsArea">
                                    <table>
                                        <tr>
                                            <td>
                                                Title
                                            </td>
                                            <td>
                                                <asp:TextBox ID="tb_Title" runat="server"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tb_Title"
                                                    CssClass="field-validation-error" ErrorMessage="*" ValidationGroup="CommentGroup"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Message
                                            </td>
                                            <td>
                                                <asp:TextBox ID="tb_Comment" runat="server" TextMode="MultiLine" Height="75px" Width="300px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tb_Comment"
                                                    CssClass="field-validation-error" ErrorMessage="*" ValidationGroup="CommentGroup"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                    </table>
                                    <br />
                                    <asp:Button ID="btn_Comment" runat="server" Text="Add Message" ValidationGroup="CommentGroup"
                                        CssClass="m-btn blue" CausesValidation="False" />
                                    <hr />
                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                        <ContentTemplate>
                                            <div id="ContentWraperMessages">
                                                <asp:Literal ID="CommentsLtr" runat="server"></asp:Literal>
                                            </div>
                                            <br />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </div>
                            </Content>
                        </asp:AccordionPane>
                    </Panes>
                </asp:Accordion>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [Profiles] WHERE ([Tourist] = ?)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [TotalCommentsPerTourist] WHERE ([Tourist] = ?)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [TotalViewsPerProfile] WHERE ([Tourist] = ?)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT TOP 5 ID, TouristVisitor FROM [Profiles_Viewed] WHERE ([ProfileVisited] = ?) ORDER BY [ID] Desc">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [TotalPostsPerTourist] WHERE ([Tourist] = ?)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource6" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM FavoriteBeach_WithName WHERE Tourist = ?">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource7" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM Albums WHERE Tourist = ?">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource8" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM Region_Tourist WHERE Tourist = ?">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource10" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM EventNameWithAttendees WHERE Attendee = ?">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource9" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM SandCastle WHERE Tourist = ?">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="Tourist" QueryStringField="Tourist" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <br style="clear: left;" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="ProfileRightSide">
        <br />
        <h3>
            Favorite Beach</h3>
        <br />
        <br />
        <asp:Label ID="lbl_NoFavBeach" runat="server" CssClass="BeachNameLabel" Text="Not Yet Selected"
            ForeColor="#9933FF" Font-Size="Small"></asp:Label>
        <asp:Label ID="lbl_FavBeach" runat="server" Visible="False" ForeColor="Red" Font-Size="Medium"></asp:Label>
        <br />
        <asp:Repeater ID="rpt_FavBeach" runat="server" Visible="False" DataSourceID="SqlDataSource6">
            <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Beach_FK", "BeachDetails.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="70" height="70" style="border-style: solid; border-width: small" />
                </asp:HyperLink>
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <h3>
            My SandCastle</h3>
        <br />
        <br />
        <asp:Label ID="lbl_NoSandCastle" runat="server" CssClass="BeachNameLabel" Text="Not Yet Added"
            ForeColor="#9933FF" Font-Size="Small"></asp:Label>
        <asp:Label ID="lbl_SandCastle" runat="server" Visible="False" ForeColor="Red" Font-Size="Medium"></asp:Label>
        <br />
        <asp:Repeater ID="rpt_SandCastle" runat="server" Visible="False" DataSourceID="SqlDataSource9">
            <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "ViewSandCastle.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="70" height="70" style="border-style: solid; border-width: small" />
                </asp:HyperLink>
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <h3>
            Albums</h3>
        <br />
        <br />
        <asp:Label ID="lbl_Albums" runat="server" CssClass="BeachNameLabel" Text="No Albums found"
            ForeColor="#9933FF" Font-Size="Small"></asp:Label>
        <asp:Repeater ID="Repeater9" runat="server" DataSourceID="SqlDataSource7">
            <ItemTemplate>
                <a id="RepeaterStyle" href="ViewAlbum.aspx?ID=<%# Eval("ID") %>">
                    <%# Eval("AlbumName")%></a>
                <br />
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <h3>
            Events</h3>
        <br />
        <br />
        <asp:Label ID="lbl_Events" runat="server" CssClass="BeachNameLabel" Text="No Events found"
            ForeColor="#9933FF" Font-Size="Small"></asp:Label>
        <asp:Repeater ID="Repeater12" runat="server" DataSourceID="SqlDataSource10">
            <ItemTemplate>
                <a id="RepeaterStyle" href="ViewMembersInEvent.aspx?Event_FK=<%# Eval("ID") %>">
                    <%# Eval("EventName")%></a>
                <br />
            </ItemTemplate>
        </asp:Repeater>
        <br />
        <h3>
            Guide</h3>
        <br />
        <br />
        <asp:Button ID="btn_Guide" runat="server" Text="View my Guide" CssClass="m-btn blue" />
        <asp:Button ID="btn_DeleteGuide" runat="server" Text="Delete" CssClass="m-btn red"
            OnClientClick="return confirm('Delete Guide?');" />
        <br />
        <br />
    </div>
</asp:Content>
